home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / emstools.arc / EMMLIB.ARC / EMM28_A.ASM < prev    next >
Assembly Source File  |  1990-02-04  |  11KB  |  174 lines

  1. ;-----------------------------------------------------------------------------;
  2. ;      MODULE NAME:   EMM28_A.ASM                                             ;
  3. ;                                                                             ;
  4. ; OS FUNCTION NAME:   get_alt_reg_set                                         ;
  5. ;                                                                             ;
  6. ;      DESCRIPTION:   This function does one of two things depending on the   ;
  7. ;                     map register set which is active at the time this       ;
  8. ;                     function is invoked:                                    ;
  9. ;                                                                             ;
  10. ;                     1. If the preceding set_alt_reg_set call was done with  ;
  11. ;                        the alt_reg_set parameter equal to zero, the         ;
  12. ;                        following points apply:                              ;
  13. ;                                                                             ;
  14. ;                        a. The context save area far pointer saved within    ;
  15. ;                           EMM by the set_alt_reg_set function is returned   ;
  16. ;                           by this call.  This far pointer is always         ;
  17. ;                           returned for boards which do not supply alternate ;
  18. ;                           mapping register sets.                            ;
  19. ;                                                                             ;
  20. ;                        b. If the context save area far pointer returned is  ;
  21. ;                           not null, this function copies the state of the   ;
  22. ;                           expanded memory mapping hardware in the system    ;
  23. ;                           into the save area specified by the far pointer.  ;
  24. ;                           The format of this save area is the same as that  ;
  25. ;                           returned by the get_context function.  This is    ;
  26. ;                           intended to simulate getting an alternate map     ;
  27. ;                           register set.  Note that the memory manager does  ;
  28. ;                           not allocate the space for the context: the       ;
  29. ;                           operating system must do so.                      ;
  30. ;                                                                             ;
  31. ;                        c. If the context save area far pointer returned is  ;
  32. ;                           null, this function does not copy the state of    ;
  33. ;                           the expanded memory hardware in the system into   ;
  34. ;                           the save area specified by the far                ;
  35. ;                           pointer.                                          ;
  36. ;                                                                             ;
  37. ;                        d. The context save area far pointer must have been  ;
  38. ;                           initialized by a previous set_alt_reg_set call.   ;
  39. ;                           Note that the value the context save area far     ;
  40. ;                           pointer saved within EMM is set to null during    ;
  41. ;                           installation of the EMM device driver.            ;
  42. ;                                                                             ;
  43. ;                        e. The context save area pointed to by the far       ;
  44. ;                           pointer to the context save area pointer must be  ;
  45. ;                           initialized by a previous get_context call.       ;
  46. ;                                                                             ;
  47. ;                     2. If the preceding set_alt_reg_set call was done with  ;
  48. ;                        the alt_reg_set parameter greater than zero, then    ;
  49. ;                        the number of the alternate map register set which   ;
  50. ;                        is in use at the time that this function is invoked  ;
  51. ;                        is returned.  The context save area pointer is not   ;
  52. ;                        returned in this case.                               ;
  53. ;                                                                             ;
  54. ;           PASSED:   &alt_reg_set:                                           ;
  55. ;                        is a far pointer to the current alternate register   ;
  56. ;                        set to be obtained.                                  ;
  57. ;                                                                             ;
  58. ;                     &far_ptr_alt_context:                                   ;
  59. ;                        is a far pointer to a far pointer to an operating    ;
  60. ;                        system supplied context save area.                   ;
  61. ;                                                                             ;
  62. ;         RETURNED:   status:                                                 ;
  63. ;                        is the status EMM returns from the call.  All other  ;
  64. ;                        returned results are valid only if the status        ;
  65. ;                        returned is zero.  Otherwise they are undefined.     ;
  66. ;                                                                             ;
  67. ;                     alt_reg_set:                                            ;
  68. ;                        If the alt_reg_set parameter returned is not zero:   ;
  69. ;                        1. The alt_reg_set parameter contains the alternate  ;
  70. ;                           map register set which was active at the time     ;
  71. ;                           that this function was invoked.                   ;
  72. ;                        2. The far pointer far_ptr_alt_context is            ;
  73. ;                           unaffected.                                       ;
  74. ;                                                                             ;
  75. ;                        If the alt_reg_set parameter returned is zero:       ;
  76. ;                        1. The far pointer far_ptr_alt_context points to an  ;
  77. ;                           area which contains the state of all the map      ;
  78. ;                           registers on all boards in the system, and any    ;
  79. ;                           additional information necessary to restore the   ;
  80. ;                           boards to their original state, has been          ;
  81. ;                           returned.  This far pointer is always returned if ;
  82. ;                           the expanded memory hardware does not supply      ;
  83. ;                           alternate mapping register sets.                  ;
  84. ;                                                                             ;
  85. ;                     far_ptr_alt_context:                                    ;
  86. ;                        The operating system first passes this pointer to    ;
  87. ;                        the memory manager whenever it invokes a             ;
  88. ;                        set_alt_reg_set function (the description            ;
  89. ;                        follows).  If the OS/E invokes this function         ;
  90. ;                        before invoking a set_alt_reg_set function, this     ;
  91. ;                        function returns a null pointer.  The OS/E must      ;
  92. ;                        have allocated the space for the save area.          ;
  93. ;                        However, the OS must request that the memory         ;
  94. ;                        manager initialize the contents of this save area    ;
  95. ;                        before it contains any useful information.           ;
  96. ;                                                                             ;
  97. ;                        The OS/E must initialize the save area it has        ;
  98. ;                        allocated by invoking the get_context function.      ;
  99. ;                        After the OS/E has done this, the save area will     ;
  100. ;                        contain the state of all the map registers on all    ;
  101. ;                        boards in the system.  The save area will also       ;
  102. ;                        contain any additional information necessary to      ;
  103. ;                        restore the boards to their original state when      ;
  104. ;                        the operating system invokes a set_alt_reg_set       ;
  105. ;                        function.                                            ;
  106. ;                                                                             ;
  107. ; C USE CONVENTION:   unsigned int       status;                              ;
  108. ;                     unsigned int       alt_reg_set;                         ;
  109. ;                     CONTEXT_STRUCT far *far_ptr_alt_context;                ;
  110. ;                                                                             ;
  111. ;                     status = get_alt_reg_set (&alt_reg_set,                 ;
  112. ;                                               &far_ptr_alt_context);        ;
  113. ;                                                                             ;
  114. ;-----------------------------------------------------------------------------;
  115. .XLIST
  116. PAGE    60,132
  117.  
  118. IFDEF SMALL
  119.    .MODEL SMALL, C
  120. ENDIF
  121. IFDEF MEDIUM
  122.    .MODEL MEDIUM, C
  123. ENDIF
  124. IFDEF LARGE
  125.    .MODEL LARGE, C
  126. ENDIF
  127. IFDEF COMPACT
  128.    .MODEL COMPACT, C
  129. ENDIF
  130. IFDEF HUGE
  131.    .MODEL HUGE, C
  132. ENDIF
  133.  
  134. INCLUDE emmlib.equ
  135. INCLUDE emmlib.str
  136. INCLUDE emmlib.mac
  137. .LIST
  138. .CODE
  139.  
  140. get_alt_reg_set        PROC                                                  \
  141.             USES DS SI DI,                                        \
  142.             ptr_alt_reg_set:FAR PTR WORD,                             \
  143.             ptr_far_ptr_alt_context:FAR PTR DWORD
  144.  
  145.     ;---------------------------------------------------------------------;
  146.     ;   do;                                                               ;
  147.     ;   .   get the current active alternate map register set or the      ;
  148.     ;   .   current mapping context if alternate map register sets are    ;
  149.     ;   .   not supported;                                                ;
  150.     ;---------------------------------------------------------------------;
  151.     MOVE        AX, get_alt_map_reg_set_fcn 
  152.     MOVE        ES:DI, 0:0
  153.     INT         EMM_int
  154.  
  155.     ;---------------------------------------------------------------------;
  156.     ;   .   pass the current active altername map register set or the     ;
  157.     ;   .   current mapping context back to the caller;                   ;
  158.     ;---------------------------------------------------------------------;
  159.     MOVE        DS:SI, ptr_alt_reg_set
  160.     MOVE        BH, 0
  161.     MOVE        DS:[SI], BX
  162.     MOVE        DS:SI, ptr_far_ptr_alt_context
  163.     MOVE        DS:[SI], ES:DI
  164.  
  165.     ;---------------------------------------------------------------------;
  166.     ;   .   return (EMM status);                                          ;
  167.     ;   end;                                                              ;
  168.     ;---------------------------------------------------------------------;
  169.     RET_EMM_STAT    AH
  170.  
  171. get_alt_reg_set        ENDP
  172.  
  173. END
  174.